#include<bits/stdc++.h>
using namespace std;
map<int,int>a;
int main(){
 //   freopen("duel.in","r",stdin);
  //  freopen("duel.out","w",stdout);
    int ans=0;int n,x,l=0,m;
    cin>>n;
    m=n;
    for(int i=1;i<=n;i++){
        cin>>x;
        a[x]++;
    }
    map<int,int>::iterator it;
    for(it=a.begin();it!=a.end();it++){
        n=n-max(l,it->second);
        if(n<=0)break;
        ans+=min(it->second,n);
        l=it->second;
    }
    cout<<m-ans;
    return 0;
}
